package org.visionlibrary.image.filters.sharpening;

import java.awt.Point;

import org.visionlibrary.image.model.ConvolutionKernel;


public class BasicSharpen {
	protected int size = 3;

	protected Point origin = new Point(1, 1);

	protected int strength = 1;

	public int getStrength() {
		return strength;
	}

	public Point getOrigin() {
		return origin;
	}

	public int getSize() {
		return size;
	}

	public void setOrigin(Point origin) {
		this.origin = origin;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public void setStrength(int strength) {
		this.strength = strength;
	}

	public ConvolutionKernel getFilterKernel() {
		float[] values = new float[size * size];
		java.util.Arrays.fill(values, -1 * strength);
		float centerValue = (size * size - 1) * strength + 1;
		int centerxy = size / 2;
		values[centerxy * size + centerxy] = centerValue;

		return new ConvolutionKernel(size, size, values, 1.0f, origin);
	}
}
